﻿@model IEnumerable<Category>
@{
    var areaCode = Request.QueryString.Get<string>("areaCode", null);
    var sortBy = Request.QueryString.Get<SortBy_Group?>("sortBy", null);
}
<div class="tn-box tn-widget tn-widget-content tn-corner-all spb-group-category">
    <div class="tn-box-header tn-widget-header tn-corner-top tn-border-bottom">
        <h3 class="tn-helper-reset">
            商户分类</h3>
    </div>
    <div class="tn-box-content tn-widget-content tn-corner-bottom">
        <div class="tn-directory">
            @if (Model != null && Model.Count() > 0)
            {
                foreach (var item in Model)
                {
                <h5 class="tn-directory-path">
                    <a href="@SiteUrls.Instance().FindGroup(areaCode, item.CategoryId, sortBy)" title="@item.CategoryName">@StringUtility.Trim(item.CategoryName,12)</a>
                </h5>
                   if (item.ChildCount > 4)
                   {
                <div class="tn-directory-more" id="hide-@(item.CategoryId)" style="display:none">
                    <div class="tn-widget tn-bubble tn-bubble-arrow-left">
                        <div class="tn-bubble-arrow">
                            <b class="tn-arrow-b1 tn-border-gray"></b><b class="tn-arrow-b2 tn-widget-bubble"></b>
                        </div>
                        <div class="tn-bubble-content tn-widget-content tn-border-gray tn-corner-all">
                            <div class="tn-directory-level">
                                @foreach (var children in item.Children)
                                {
                                    <span class="tn-directory-item"><a href="@SiteUrls.Instance().FindGroup(areaCode, children.CategoryId, sortBy)" title="@children.CategoryName">@children.CategoryName</a></span>
                                }
                            </div>
                        </div>
                    </div>
                </div>  
                <span class="tn-expand"><a menu="#hide-@(item.CategoryId)" data_menu_position="right" href="#" class="tn-icon tn-smallicon-slide-next" >展开</a> </span>
                       }
                  
                <div class="tn-directory-level tn-border-bottom tn-border-gray">
                    @foreach (var children in item.Children.Take(4))
                    { <span class="tn-directory-item"><a href="@SiteUrls.Instance().FindGroup(areaCode, children.CategoryId, sortBy)" title="@children.CategoryName">@StringUtility.Trim(children.CategoryName,7)</a></span>
                    }
                </div>
                }
            }
            else
            {
                <div class="tn-no-data">
                    还没有分类!</div> 
            }
            <p class="tn-more">
                <a href="@SiteUrls.Instance().FindGroup(null, null, null)">查看更多分类</a></p>
        </div>
    </div>
</div>
